﻿<%@ Page Language="c#" Inherits="WinnerCMS.WebUI.Admin.Gather.Main" CodeBehind="Main.aspx.cs" %>

<%@ Register Src="../UC_AjaxLoading.ascx" TagName="UC_AjaxLoading" TagPrefix="uc1" %>
<!doctype html>
<html>
<head runat="server">
    <meta charset="utf-8">
    <meta content="no-cache" http-equiv="Pragma" />
    <title>采集任务</title>
    <%: Scripts.Render("~/Scripts/AdminBase") %>
    <%: Styles.Render("~/Content/Bootstrap/css") %>

    <script runat="server">

        protected string Pageurl(object name, object id)
        {
            return "javascript:return NewTabPage('采集" + name + "','Gather/WrokConfig.aspx?ModelId=" + ModelId + "&IDs=" + id + "');";
        }

    </script>
    <script type="text/javascript">
        $(function ()
        {
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            prm.add_endRequest(Init);
 
            Init();
        });
        function Init()
        {
            $(".StartUrlLinks").each(function ()
            {
                if ($(this).find("a").length > 2)
                {
                    $(this).height("42px");
                } else
                {
                    $(this).height("auto");
                }
            });
        }
        function scoll(obj)
        {
            if ($(obj).data("IsOpen") == "false")
            {
                $(obj).data("IsOpen", "true");
                $(obj).height("auto");
            }
            else
            {
                $(obj).data("IsOpen", "false");
                $(obj).height("42px");
            }
        }
        function GatherSelected()
        {
            var ids = new Array();
            $("#GV_List").find("td input").each(function ()
            {
                if (this.checked)
                    ids.push(this.value);
            });
            if (ids.length > 0)
                NewTabPage('采集', 'Gather/WrokConfig.aspx?ModelId=' + Request.QueryString("ModelId") + '&IDs=' + ids.join(','));
            else
                alert("请勾选。");
        }
        function GatherAll()
        {
            NewTabPage('采集', 'Gather/WrokConfig.aspx?ModelId=' + Request.QueryString("ModelId") + '&IDs=');
        }
        function RuleNode(id)
        {
            $("#dialog-modal").dialog({
                height: 800,
                width: 800,
                title: "规则节点",
                modal: true
            });
            var urlC = $("#dialog-modal-url");
            urlC.attr("src", "RuleNode.aspx?ModelId=" + Request.QueryString("ModelId") + "&PID=" + id);

            urlC.height(800);
        }
    </script>
</head>
<body>
    <form id="Form1" method="post" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
        <ProgressTemplate>
            <uc1:UC_AjaxLoading ID="UC_AjaxLoading1" runat="server" />
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <BootStrap:Breadcrumb ID="BC_Path" runat="server">
            </BootStrap:Breadcrumb>
             
            <div style="width:200px;float:left"  >
                <input id="btnGatherSelected" type="button" onclick="GatherSelected();" value="采集"
                    class="btn btn-default" />
                <input type="button" value="全部采集" onclick="GatherAll();" class="btn btn-default" />
                
                
            </div>
           <div style="width:300px;float:right"  >
            <div class="input-group" style="float: right">
                    <asp:TextBox ID="txtKeyWord" runat="server" class="form-control"></asp:TextBox>
             
                <span class="input-group-btn"><BootStrap:Button ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click"/></span>
                </div></div> 
            <asp:Repeater ID="RPList"  runat="server">
            <HeaderTemplate><table id="GV_List" class="table table-bordered table-striped table-hover">
                <thead>
                    <tr class="HeaderStyle">
                        <th scope="col" style="text-align:left;">
                            <input name="chkHeader" onclick="javascript:SelectAll(this);" type="checkbox" value="chkHeader" /> 任务别名
                        </th>
                        <th scope="col" style="width: 50px;">
                            采集
                        </th>
                        <th scope="col" style="width: 80px; ">
                            规则节点
                        </th>
                        <th align="center" scope="col" style="width: 60px;">
                            启用
                        </th>
                        <th scope="col" style="width: 120px;">
                            栏目
                        </th>
                        <th scope="col" style="width: 100px;">
                            最后采集
                        </th>
                        <th scope="col" style="width: 40px;">
                            删除
                        </th>
                    </tr>
                </thead>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <input type="checkbox" value='<%# Eval("ID") %>' /><asp:HiddenField ID="hfID" runat="server"
                            Value='<%# Eval("ID") %>' />
                        <a href="Add.aspx?ModelId=<%= Request["ModelId"] %>&ID=<%# Eval("ID") %>">【<%# Eval("Name") %>】</a>
                        <div class="StartUrlLinks" onclick="scoll(this)" style="overflow: hidden; width: 100%;">
                            <%# StartUrlLinks(Eval("StartUrl")) %>
                        </div>
                    </td>
                    <td align="center" style="width: 40px;">
                        <asp:HyperLink ID="HL_GatherData" onclick='<%# Pageurl(Eval("Name"), Eval("ID")) %>'
                            NavigateUrl="#" runat="server">采集</asp:HyperLink>
                    </td>
                    <td align="center" style="width: 60px;">
                        <a href="javascript:void(0)" onclick="RuleNode(<%# Eval("ID") %>)">规则节点</a>
                    </td>
                    <td align="center">
                        <asp:ImageButton ID="ImageButton1"
                              CommandName="DisableOrUsedIt" ImageUrl="../Images/success-true.gif"  runat="server" />
                    </td>
                    <td align="center" style="width: 120px;">
                        <%# Eval("Category.CategoryName") %>
                    </td>
                    <td align="center" style="width: 110px;">
                        <%# Eval("LastWork", "{0:yy-MM-dd HH:mm:ss}") %>
                    </td>
                    <td align="center" style="width: 40px;">
                       <asp:Button ID="btnDelete" CssClass="btn btn-danger" CommandName="Delete" runat="server" Text="删除" OnClientClick="return confirm('您确定要删除？');" />
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate></table></FooterTemplate>
            </asp:Repeater>
            <WinnerCMS:PageNavigation ID="PageNavigation1"
                runat="server" PageSize="10" EnableViewState="False" SubmitButtonclass="btn btn-default"
                UrlPaging="True">
            </WinnerCMS:PageNavigation>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
    <div id="dialog-modal">
        <iframe id="dialog-modal-url" style="width:100%" frameborder="0" scrolling="no"></iframe>
    </div>
</body>
</html>
